package com.revenant.driver.adapter.Driver;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.revenant.driver.R;
import com.revenant.driver.bean.AreaShowBean;
import com.revenant.driver.bean.Driver.PingTaiBean;
import com.revenant.driver.bean.Driver.ZhiPaiListBean;

import java.util.Arrays;
import java.util.List;

/**
 * @ProjectName: Shipper
 * @Package: com.revenant.shipper.adapter
 * @ClassName: MineBigItemAdapter
 * @Description: java类作用描述
 * @Author: revenant
 * @CreateDate: 2019-12-30 14:18
 * @UpdateUser: 更新者
 * @UpdateDate: 2019-12-30 14:18
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class ZhiPaiAdapter extends BaseQuickAdapter<ZhiPaiListBean.DataBean.ResultBean, BaseViewHolder> {

    List<String> danwei= Arrays.asList("吨","方","米","件");

    public ZhiPaiAdapter() {
        super(R.layout.item_shipper_published);
    }

    @Override
    protected void convert(BaseViewHolder helper, ZhiPaiListBean.DataBean.ResultBean item) {
        helper.setText(R.id.start_place, item.getLoading());
        helper.setText(R.id.end_place, item.getUnloading());
        helper.setText(R.id.shengyu,"剩余"+ String.valueOf(item.getTotal())+"辆");

        Double aweight = Double.valueOf(item.getWeight());
        String resultweight = String .format("%.0f",aweight);


        Double aprice = Double.valueOf(item.getPrice());
        String resultprice = String .format("%.0f",aprice);

        if (item.isIsOnline()) {
            helper.setText(R.id.onoroff, "线下");
        } else {
            helper.setText(R.id.onoroff, "线上");
        }
        helper.setText(R.id.price_published, "预估价:"+resultprice);
//        if (item.isIsOnline()) {
//            helper.setText(R.id.onoroff, "线上");
//        } else {
//            helper.setText(R.id.onoroff, "线下");
//
//        }
        String text =danwei.get(item.getDanwei()-1);
        helper.setText(R.id.type_and_weight, item.getVehicleLeader() + "|" + String.valueOf(resultweight)+text);
//        helper.setText(R.id.price_published,String.valueOf(item.getPrice()));
        helper.setText(R.id.time_published, String.valueOf(item.getCreateTime()));
        if (item.isIsAuto()) {
            helper.setText(R.id.isauto_confirm, "手动确认");
        } else {
            helper.setText(R.id.isauto_confirm, "自动确认");
        }
        helper.setText(R.id.companyName, item.getCompanyName());

    }
}
